const mongoose = require('mongoose');
const config   = require('../config');
const logger = require('../common/logger');
const Promise = require("bluebird");
mongoose.Promise = Promise;
//mongoose.connect(config.db, {useMongoClient: true });
mongoose.connect(config.db,{
    server: {auto_reconnect: true,poolSize: 20},
    useMongoClient: true
}, function (err) {
    if (err) {
        logger.error('connect to %s error: ',config.db, err.message);
        process.exit(1);
    }
});

// 系统注册用户名models
// require('./serviceuser');
// exports.serviceuser = mongoose.model('serviceuser');

// //登陆信息表
// require('./servicelogin');
// exports.servicelogin = mongoose.model('servicelogin');

//邀请信息表
require('./inviteroom');
exports.inviteroom = mongoose.model('inviteroom');  

//客户端用户信息
require('./clientuser');
exports.clientuser = mongoose.model('clientuser');  

// //后台信息采集单
// require('./acquiorder');
// exports.acquiorder = mongoose.model('acquiorder');

// //已办事项
// require('./handling');
// exports.handling = mongoose.model('handling');

//聊天记录表
require('./chatrecord');
exports.chatrecord = mongoose.model('chatrecord');






